docs(vscode-extension): state what Export to React actually does - #8112
Conversation
The page described the `ObjectUI: Export to React` command in two ways it does not behave. 1. The Usage list said "React component code is copied to clipboard". It is not: `exportToReact()` opens an untitled document with `language: 'typescriptreact'`, shows it, and shows the message `React component generated! Save it to a .tsx file.` The identifier `clipboard` does not occur anywhere under `packages/vscode-extension/src`. The list now states the untitled `typescriptreact` tab, the message, and that nothing is written to disk or to the clipboard. 2. The Output Example imported only `SchemaRenderer` and so omitted `import '@object-ui/components';`, which is load-bearing: that package declares `sideEffects: true` and its barrel is what registers the default renderers, so a reader who copied the documented example instead of running the command got a SchemaRenderer with nothing registered. The Output Example is now the command's real product, byte for byte: the template was read out of `generateReactComponent()` the way `export-to-react-preamble.test.ts` reads it and evaluated against the example schema this page already taught. The absent `import React from 'react'` stays absent — objectui#7862 removed it deliberately, and the template's own comment explaining why is reproduced with the rest of the product. Docs only; no gate binds the page to the template (that is objectui#7976). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
|
Standing down on
Every other check on Generated by Claude Code |
|
Armed — squash auto-merge enabled and the PR is in the merge queue,
On MERGED: content probe on re-fetched Generated by Claude Code |
|
LANDED — merged at 2026-09-06T17:12:43Z as Content probe on re-fetched
#7977 closed by the Generated by Claude Code |
Fixes #7977
The page for the VS Code extension described
ObjectUI: Export to Reactin two ways the command does not behave. Both are corrected against the command's actual product on this base, not against the card's transcript — the card predates PR #7978.1. How the product was obtained (extracted, not transcribed)
generateReactComponent()lives in a template literal, so nothing compiles it. I read that template out ofpackages/vscode-extension/src/extension.tsexactly the waysrc/__tests__/export-to-react-preamble.test.tsreads it (locatefunction generateReactComponent, then thereturnbacktick, then the closing backtick) and evaluated it with the one binding it takes,schemaJson = JSON.stringify(schema, null, 2), against the example schema this page already taught. Read-only: nothing underpackages/vscode-extension/was touched.The docs fence is now that product byte for byte — asserted mechanically, not by eye:
Quoting the product here, with its last statement spelled in words rather than literally, because GitHub's body sanitizer eats angle-bracket-shaped tokens even inside fenced blocks:
2. The clipboard sentence
Before (
content/docs/utilities/vscode-extension.mdx:79):After — a statement of what the command does, rather than a deletion of the word
clipboard:That is
exportToReact()atextension.ts:205-214:openTextDocument({ content, language: 'typescriptreact' }),showTextDocument, then that exact message. The identifierclipboardoccurs nowhere underpackages/vscode-extension/src.3. The Output Example
Before: one import (
SchemaRendererfrom@object-ui/react), no semicolons, component namedMyComponent, and noimport '@object-ui/components';.After: the product above. Three differences from the old example, all of them the generator's:
import '@object-ui/components';is present. It is load-bearing (objectui#7837: the package declaressideEffects: true, its barrel runsimport './renderers', and its builtdist/index.jscarries 114 module-scoperegister(call sites) — a reader who copied the old example instead of running the command registered no renderers at all.GeneratedComponent, which is what the command emits.JSON.stringify(schema, null, 2)expansion, so the nested child is on its own lines.A short lead paragraph above the fence now says the imports are part of the output and why the side-effect import matters, so the point survives a reader who skims the code.
import React from 'react'stays absent — objectui#7862 / PR #7978 removed it deliberately, and the triage made that a hard constraint.4. Decision asked for: the template's comments are reproduced verbatim
The ruling left this to me. I kept both comments, for two reasons: it makes the example the product byte for byte (no editorial judgement about which half of a generated file a reader gets), and the four-line comment is the page's own defence of the absent React import — the next reader or agent who thinks the example is missing an import reads the answer in place. The two-line comment is likewise the answer to "why is there a bare import here".
5. No gate
No pin, no binding of the page to the template — that is objectui#7976's class and would open a new scan population. The file surface is one
content/docspage.Gates (all on this branch's final HEAD)
pnpm check:doc-snippetsEvery covered documentation snippet compiles against the built types.Root bound: no block imports a specifier that resolves only through this repository's ROOT manifest.Semantic phase: 561 of 561 block(s) judged, 0 failed.pnpm check:doc-fencespnpm check:doc-typesEvery documented component type is registered.(the page'sDOC_TYPE_EXEMPTIONSentry still covers it)pnpm exec vitest run scripts/__tests__/check-doc-component-types.test.ts"type": "h1"pnpm exec vitest run packages/vscode-extension/node scripts/check-doc-links.mjspnpm check:control-bytes+grep -naPon the changed pathnode scripts/check-changeset-presence.mjsno changeset is owed(docs only)node scripts/check-governed-queue-guard.mjs --testNOT GOVERNEDpnpm check:docs-route-closure,pnpm check:doc-example-readersExit codes captured by redirect-then-capture, never through a pipe.
The snippet gate really judges this block — proven by ablation rather than assumed. Pointing the added import at a package that does not exist turns the gate red on this exact file and line:
Restored from
HEADand proven restored by blob hash and an emptygit diff HEAD.Repo-wide
pnpm lintis not owed by this diff, measured:eslint --format jsonon the changed path judges 1 file and reportsFile ignored because no matching configuration was supplied.The population is read from eslint's own configuration, the count from its JSON output; since the only changed file is outside that population, no eslint verdict anywhere can move from this change.PM mechanism assumptions, both falsified in the helpful direction
check:doc-snippetsmight refuse@object-ui/componentsthrough objectui#8059's root bound): it does not. The gate's ownRoot bound:line reports no refusal, and the ablation above shows the specifier genuinely resolving.typescriptfence might trip on JSX, needingtsx): it does not, and the fence is unchanged.check-doc-snippet-types.mjs:1433-1440parses every block asScriptKind.TSXregardless of the fence label, precisely because the corpus labels JSX blocksts/tsx/typescriptinterchangeably.Live E2E (informational)is red on every branch today for an upstream reason (#7990) and is not from this change.Generated by Claude Code